import { lazy } from "react";

import { Navigate, useRoutes } from 'react-router-dom'
let Home = lazy(() => import('../view/home/index'))
let Login = lazy(() => import('../view/login/index'))
let Shouye = lazy(() => import('../view/shouye/index'))
let My = lazy(() => import('../view/my/index'))
let Jiudianlist = lazy(() => import('../view/jiudianList/index'))
let Search = lazy(() => import('../view/search/index'))
let Detail = lazy(() => import('../view/detail/index'))
let Listll=lazy(()=>import('../view/list11/index'))
let routes = [
    {
        path: '/',
        element: <Navigate to="/home/shouye"></Navigate>
    },
    {
        path: "/home",
        element: <Home></Home>,
        children: [
            {
                path: '/home/shouye',
                element: <Shouye></Shouye>,
                title: "首页"
            },
            {
                path: '/home/my',
                element: <My></My>,
                title: "我的"
            },
            {
                path: "/home/jiudianList",
                element: <Jiudianlist></Jiudianlist>,
                title: "酒店列表"
            },
            {
                path: "/home/search",
                element: <Search></Search>,
                title: "搜索列表"
            },
            {
                path: "/home/detail",
                element: <Detail></Detail>,
                title:"详情"
            },
            {
                path:'/home/list11',
                element:<Listll></Listll>,
                title:"新列表"
            }
        ]
    },
    {
        path: "/login",
        element: <Login></Login>
    },

]

export const RouterView = () => {
    return useRoutes(routes)
}

export default routes